package com.booksystem.campuslibrarymanagementsystem.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.booksystem.campuslibrarymanagementsystem.commen.request.userquest.Feedbackquest.Feedback;
import com.booksystem.campuslibrarymanagementsystem.entity.AccountTable;
import com.booksystem.campuslibrarymanagementsystem.entity.FeedbacksTable;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface FeedbacksTableMapper extends BaseMapper<FeedbacksTable> {
    //通过反馈id修改state和accountids，用于处理反馈
    @Update("update feedbacks_table set accountid = #{accountid},state = #{state} where id= #{id}")
    boolean upDataState(int id,String accountid,String state);

    //通过id查询单条信息
    @Select("select * from feedbacks_table where id = #{id}")
    FeedbacksTable queryById(int id);

    @Insert("INSERT INTO feedbacks_table (account, content, time, state) VALUES (#{account}, #{content}, #{time}, #{state})")
    int saveb(FeedbacksTable fee);

    //账户id查询反馈信息
    @Select("select * from feedbacks_table where account = #{account}")
    List<FeedbacksTable> selectByaccount(@Param("account") String account);

    //删除该账户的反馈记录
    @Delete("DELETE FROM feedbacks_table WHERE account = #{account} and id = #{id}")
    int deleteFeedbackid(@Param("account") String account,@Param("id") int id);

}
